import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
import { getDynamicData } from "@/APIs/flowSegmentation";
const state = {
  professionList: null,
};
const getters = {
  professionList: (state) => {
    if (!state.professionList) {
      Store.dispatch("getprofessionList");
    }
    return state.professionList;
  },
};
const mutations = {
  SET_PROFESSION_LIST: (state, data) => {
    state.professionList = data;
  },
};
const actions = {
  async getprofessionList({ commit }) {
    const res = await getDynamicData("flow_segmentation");
    console.log("actions-res", res);
    commit("SET_PROFESSION_LIST", res);
  },
};
const modules = {};
const Store = new Vuex.Store({
  state,
  getters,
  mutations,
  actions,
  modules,
});
export default Store;
